/**
 * 
 */
package com.rtsp.tool.snatch01;

import java.awt.image.BufferedImage;
import java.io.File;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import javax.imageio.ImageIO;
import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.Frame;
import org.bytedeco.javacv.Java2DFrameConverter;
import org.bytedeco.javacv.OpenCVFrameConverter;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

/**
 * @author w.weizhen
 * 
 */
public class RunnableMain01 {
	
	/**
	 * @param args
	 */
	public static void main(String[] args) 
	{
		ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
		
		JSONArray datas = new JSONArray();
//		datas.add(JSON.parseObject("{code:'L12051310', url:'rtsp://admin:19870513qq@192.168.12.104:554/Streaming/Channels/101'}"));
//		datas.add(JSON.parseObject("{code:'135152559', url:'rtsp://admin:88888888b@192.168.12.105:554/Streaming/Channels/101'}"));
//		datas.add(JSON.parseObject("{code:'F93882634', url:'rtsp://admin:88888888b@192.168.12.106:554/Streaming/Channels/101'}"));
		
//		datas.add(JSON.parseObject("{code:'L12051310', url:'rtsp://admin:19870513qq@192.168.12.104:554/h264/ch1/main/av_stream'}"));
//		datas.add(JSON.parseObject("{code:'135152559', url:'rtsp://admin:88888888b@192.168.12.105:554/h264/ch1/main/av_stream'}"));
		datas.add(JSON.parseObject("{code:'F93882634', url:'rtsp://admin:88888888b@192.168.12.106:554/h264/ch1/main/av_stream'}"));
		
		RtspSnatchRunnable01 tsr = null;
		for (int i = 0; i < datas.size(); i++) 
		{
			JSONObject data = datas.getJSONObject(i);
			tsr = new RtspSnatchRunnable01(data.getString("code"), data.getString("url"));
			service.scheduleAtFixedRate(tsr, 5, 100, TimeUnit.MILLISECONDS);
			tsr.run();
		}
		
		
		
		
		
	}
	
	
}